package v1

import (
	"devops-super/api"
	"devops-super/internal/model/entity"
	"devops-super/internal/model/mymodel"
	"github.com/gogf/gf/v2/frame/g"
)

type GetPageLstReq struct {
	g.Meta `method:"get" path:"/product/page-list" summary:"分页获取产品列表" tags:"产品"`
	*api.PageLstReq
	Name       string   `json:"name" description:"产品名"`
	ProductKey string   `json:"productKey" description:"productKey"`
	Type       string   `json:"type" description:"类型"`               // 0直连 1网关 2子设备
	OpenStatus string   `json:"openStatus" description:"openStatus"` // 【0非激活 1激活】
	TimeRange  []string `json:"timeRange"`                           // 时间范围[开始,结束]
}

// GetPageLstRes 获取产品列表响应
type GetPageLstRes struct {
	*api.PageLstRes[*mymodel.AppProductResponse] // 修改为新的响应结构体
}

type AddReq struct {
	g.Meta `method:"post" path:"/product" summary:"新增产品" tags:"产品"`
	*mymodel.Product
}

type AddRes struct{}

type UptReq struct {
	g.Meta `method:"put" path:"/product/{id}" summary:"更新产品" tags:"产品"`
	Id     int `v:"min:1#产品ID必须" path:"id"`
	*mymodel.Product
}

type UptRes struct{}

type UptStatusReq struct {
	g.Meta     `method:"patch" path:"/product/{id}/status" summary:"更新产品状态" tags:"产品"`
	Id         int `v:"min:1#产品ID必须" path:"id"`
	OpenStatus int `v:"required" json:"openStatus"`
}

type UptStatusRes struct{}

type DelReq struct {
	g.Meta `method:"delete" path:"/product/{id}" summary:"删除产品" tags:"产品"`
	Id     int `v:"min:1#产品ID必须" path:"id"`
}

type DelRes struct{}

type GetOneReq struct {
	g.Meta `method:"get" path:"/product/getOne" summary:"获取一条" tags:"产品"`
	Id     int `v:"min:1#产品ID必须" path:"id"`
}

type GetOneRes struct {
	Info *entity.AppProduct `json:"info"`
}

type GetOptionsReq struct {
	g.Meta     `method:"get" path:"/product/getOptions" summary:"获取产品选项" tags:"产品"`
	FieldKey   string `json:"fieldKey"`   //明确指出key的字段
	FieldLabel string `json:"fieldLabel"` //明确指出label的字段
}

type GetOptionsRes struct {
	Options []*api.FormOptionsItem `json:"options"`
}
